<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="../../css/model.css">
    <link rel="stylesheet" href="../style/jdbp-1012/pc/style.css">
    <title>家电爆品集选</title>
</head>

<body>
    <div class="header"></div>
    <div class="body">
        <div class="topbanner"></div>
        <div class="title-1">电视</div>
        <div class="container clearfix"></div>
        <div class="title-1">冰箱</div>
        <div class="container clearfix"></div>
        <div class="title-1">洗衣机</div>
        <div class="container clearfix"></div>
        <div class="title-1">热水器</div>
        <div class="container clearfix"></div>
        <div class="title-1">烟灶消具</div>
        <div class="container clearfix"></div>
        <div class="title-1">空调</div>
        <div class="container clearfix"></div>
        <div class="back-top">
            <img src="../images/jdbp_1012/pc/back-top.png" alt="">
        </div>    
    </div>
    <div class="footer"></div>
    <!-- templat start -->
    <script type="text/html" id="card-tpl">
        <img class="img" src="{{pic}}"></img>
        <p>{{name}}</p>
        <div>
            <p>购买价:￥
                <span>{{discountPrice}}</span>
            </p>&nbsp;
            <span>原售价:￥
                <span>{{price_on_tag}}</span>
            </span>
        </div>
    </script>
    <script type="text/html" id="ctx-tpl">
        {{each $data}}
            <a class="card fl" target='_blank'></a>
        {{/each}}
    </script>
</body>
<script type="text/javascript" src="../../js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="../../js/art-template.js"></script>
<script src="../../js/login.js"></script>
<script src="../../js/model.js"></script>
<script>
    // init start
    var WWW_URL = 'http://www.cjwsc.com';
    $(".header").topBox();
    $(".footer").footBox();
    // init end
    (function ($, template) {
        var info = [
            [113165, 93162, 143870],
            [126330, 105958, 140132],
            [115846, 127408, 99522],
            [108304, 140561, 143195],
            [147025, 104212, 131562],
            [114539, 115881, 141457]
        ]

        function getData(id, idx, index) {
            $.ajax({
                url: 'http://www.cjwsc.com/qcwdProduct/getProductByIds',
                data: {
                    ids: id,
                    business_type: 10,
                    client_type: 1
                },
                dataType: "jsonp",
                jsonp: 'jsonpcallback',
                success: function (res) {
                    var href = 'http://www.cjwsc.com/item/' + id + '.html';
                    res.msg[0].index = idx + 1;
                    res.msg[0].pic = res.msg[0].pic.replace('240_240', '800_800')
                    var element = index ? $('.container').eq(index).find('.card').eq(idx) : $('.card').eq(idx);
                    element.html(template('card-tpl', res.msg[0])).attr('href', href);
                    if (res.msg[0].stock_num == 0 || res.msg[0].status == 2) element.addClass('masker')
                        .removeAttr('href');
                }
            })
        }

        function setData(info){
            for(var i=0,len=info.length;i<len;i++){
                $('.container').eq(i).html(template('ctx-tpl',info[i]))
                for(var j=0,leng=info[i].length;j<leng;j++){
                    getData(info[i][j],j,i)
                }
            }
        }
        setData(info)

        $('.back-top').on('click', function () {
            $('html,body').animate({
                scrollTop: 0
            }, 500)
        })
    })($, template)
</script>

</html>